// use

pub mod a{
    use serde::{Serialize, Deserialize};
    use jsonwebtoken::{encode, decode, Algorithm, Validation, DecodingKey, EncodingKey, TokenData, Header};
    use std::time::{SystemTime, UNIX_EPOCH};
    // use crate::pkg::util::jwt;
     


    /// Our claims struct, it needs to derive `Serialize` and/or `Deserialize`
    #[derive(Debug, Serialize, Deserialize)]
    struct Claims {
        usr: String,
        email: String,
        exp:u64,
    }

    pub fn test_entry() {
        log_out();
        test_jwt();
        test_utils();
    }

    pub fn log_out() {
        let a= vec!["1", "2"];
    }


    pub fn test_jwt() ->String{
        const HOUR: u64 = 60*60;
        let exp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() + 3 * HOUR ;
        let my_claims = Claims {
            usr: "b@b.com".to_owned(),
            email: "ACME".to_owned(),
            exp,
        };

        // my_claims is a struct that implements Serialize
        // This will create a JWT using HS256 as algorithm
        encode(&Header::default(), &my_claims, &EncodingKey::from_secret("secret".as_ref())).unwrap()
        // decode()
    }

    pub fn test_utils() {
        // let token = jwt::UtilJwt::gen_token("test.@asdf.com".to_string());
        // println!("the token is {}", token);
        // let valid_token = jwt::UtilJwt::valid_token(token);
        // println!("valid token is {:?}", valid_token);
    }
}
